package com.cyou.qb.common.dao;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Component;

import com.cyou.qb.common.domain.BlackList;

/**
 * @author zoudongchao
 *
 */
@Component
public class BlackListDao extends MysqlBaseDao {
	/**
	 * <p>查找唯一黑名单</p>
	 * @param passport	通行证
	 * @param time	当前时间
	 * @return 返回空或者返回一个唯一黑名单
	 */
	public List<BlackList> findBlackList(String passport, Date time){
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("passport", passport);
		params.put("time", time);
		return this.getListByEntity("findBlackList", params);
	}
	
	/**
	 * <p>查找所有有效黑名单</p>
	 * @author zoudongchao
	 * @return
	 */
	public List<BlackList> findAllValidBlackList() {
		return this.getList("findAllValidBlackList");
	}

	/**
	 * <p>保存黑名单</p>
	 * @author zoudongchao
	 * @param blackList
	 * @return
	 */
	public int saveOneBlackList(BlackList blackList){
		return this.insert("insertOneBlackList", blackList);
	}
	
	/**
	 * <p>删除黑名单</p>
	 * @author zoudongchao
	 * @param blackListId 黑名单id
	 * @return
	 */
	public int deleteBlackListById(int blackListId) {
		return this.delete("deleteBlackListById", blackListId);
	}
}
